




import 'package:baselib/util/common_utils.dart';
import 'package:baselib/util/const_config.dart';
import 'package:baselib/util/shared_preferences_util.dart';
import 'package:flutter/material.dart';
import 'package:flutter_app/home/home_page.dart';
import 'package:flutter_app/service/web_socket_service.dart';
import 'package:flutter_app/util/colours.dart';
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
import 'package:get/get.dart';
import 'package:baselib/base/app_channel.dart';
import 'package:baselib/http/dio_init.dart';
import 'package:web_socket_channel/io.dart';
import 'SplashPage.dart';



Future<void> main() async {
  await initServices(); /// 等待服务初始化.
  Channel.currentChannel= APPChannel.DEV;///初始化渠道
  HttpUtil.getInstance();///初始化网络配置
  runApp(MyApp());
}

void initServices() async {
  ///这里是你放get_storage、hive、shared_pref初始化的地方。
  ///或者moor连接，或者其他什么异步的东西。
  Get.put(SharedPreferencesService().init());
  Get.put(WebSocketService().init());
}

class SharedPreferencesService extends GetxService {
  void init() async {
     await SharedPreferencesUtils.init();
  }
}

class MyApp extends StatelessWidget {
  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    return GetMaterialApp(
      title: 'Flutter Demo',
      theme: ThemeData(
        primarySwatch: Colors.blue,
        visualDensity: VisualDensity.adaptivePlatformDensity,
      ),
      debugShowCheckedModeBanner:false,
      builder: (BuildContext context, Widget child) {
        return FlutterSmartDialog(child: child);
      },
      home: Scaffold(
        body: SplashPage(),
      ),
    );
  }


}



